<form id="ads-form" lay-filter="ads-form" class="layui-form model-form zfrom" enctype="multipart/form-data">
	<input name="userIdCreate" type="hidden" />

	<div class="layui-row layui-col-space30" id="ads_list">
		<div class="layui-col-md6 layui-col-sm6">
			<label class="layui-form-label">选择图片</label>
			<div class="hdImgBtn" id="uploadImgBtn">
				<input class="uploadImg" type="file" name="picUrl" id="file1">
			</div>
		</div>
		<div class="layui-col-md6 layui-col-sm6">
			<div class="layui-form-item">
				<label class="layui-form-label">活动开始时间</label><br />
				<div class="">
					<input type="data" class="layui-input" name="data" id="test1" placeholder="yyyy-MM-dd">
				</div>
			</div>

			<div class="layui-form-item">
				<label class="layui-form-label">活动结束时间</label><br />
				<div class="">
					<input type="data" class="layui-input" name="data" id="test2" placeholder="yyyy-MM-dd">
				</div>
			</div>
		</div>
	</div>
	<i class="layui-clear"></i>
	<div class="layui-form-item model-form-footer">
		<button class="layui-btn layui-btn-primary" ew-event="closeDialog" type="button">取消</button>
		<button class="layui-btn" lay-filter="ad-form-submit" lay-submit>保存</button>
	</div>
</form>
<script>
	$(document).ready(function() {
		$("#file1").on("change", upload);
	})
	var paths = ''

	function upload() { /** * 我们存一下this对象， * 我们将在ajax的回调函数中， * 将要用这个对象， * 用它来改变父盒子的背景图 * */
		var self = this;
		$.ajax({
			url: uploadHead,
			type: "post",
			dataType: "json",
			cache: false,
			data: new FormData($("#formTag3")[0]),
			xhrFields: {
				withCredentials: true
			},
			processData: false, // 不处理数据 
			contentType: false, // 不设置内容类型 
			success: function(data) { /* 后端返回的数据格式为 {"url": "xxxxxx"} */
				console.log(data)
				$(self).parent().css({
					"background-image": "url(" + data.rows + ")"
				})
			}
		})
	}
</script>